
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.sjk.flink.util.ObjectMapperUtil;
import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

public class ChangeStrMain {
    public static void main(String[] args) throws Exception{
        String json = "[{\"data\":[102,116,112,115,58,47,47,49,55,50,46,49,54,46,50,52,48,46,50,48,48,58,50,49,47,78,74,47,71,83,47,71,83,95,74,71,95,84,70,83,74,81,88,47,70,74,47,50,48,50,51,48,52,50,49,47,50,55,55,56,52,50,50,50,51,55,52,57,55,53,48,54,54,46,106,112,103]}]";
        JSONArray jsonArray = new JSONArray(json).getJSONObject(0).getJSONArray("data");
        String vstr = new JSONArray(json).getJSONObject(0).getString("data");
        System.out.println(">>>>>>>>>       "+vstr);
        //JSONObject aaa = new JSONArray(json).getJSONObject(0).getJSONObject("data");
        List<Integer> userList = ObjectMapperUtil.getObjectMapper().readValue(vstr, new TypeReference<List<Integer>>(){});
        System.out.println("userList    ddddd >> "+userList);
        int bound = userList.size();
        byte[] bes = new byte[bound];
        for (int i = 0; i < bound; i++) {
            int anInt = (int)jsonArray.get(i);
            bes[i] = (byte)anInt;
        }
        String str = new String(bes);
        System.out.println(str);
        /**
        String  bbb = "ftps://172";
        byte[] b = bbb.getBytes();
        int []  arr = { 1, 2 , 3 } ;
        String scrData ="{}";
        ObjectNode readTree = (ObjectNode)ObjectMapperUtil.getObjectMapper().readTree(scrData);
        readTree.put("JCZ",b);
        readTree.put("arr",arr);
        System.out.println(ObjectMapperUtil.getObjectMapper().writeValueAsString(readTree));

        Object o = [102,116,112,115,58,47,47,49,55,50,46,49,54,46,50,52,48,46,50,48,48,58,50,49,47,78,74,47,71,83,47,71,83,95,74,71,95,84,70,83,74,81,88,47,70,74,47,50,48,50,51,48,52,50,49,47,50,55,55,56,52,50,50,50,51,55,52,57,55,53,48,54,54,46,106,112,103];
        String binaryData = "dddddd";
        byte[] byteArray = binaryData.getBytes();
        StringBuilder sb = new StringBuilder();
        for (byte b : byteArray) {
            sb.append(String.format("%8s", Integer.toBinaryString(b & 0xFF)).replace(' ', '0'));
        }
        String result = sb.toString();
        System.out.println(result);
         **/
    }
}
